//
//  Message.swift
//  uwantgoeasy
//
//  Created by 冯传宝 on 12/9/15.
//  Copyright © 2015 uwantsoft. All rights reserved.
//

import Foundation

class Message{
    var type:String
    var content:[UInt8] = [UInt8]()
    
    init(type:String, content:[UInt8]){
        self.type = type
        self.content = content
    }
    
    func jsonAsString()->String{
        var intContent:[Int] = Array(count: content.count, repeatedValue: 0)
        for (index, value) in content.enumerate(){
            intContent[index]=Int(value)
        }
        var dict = [String: AnyObject]()
        dict["type"]=self.type
        dict["content"]=intContent
        return GoEasyJsonUtils.dictAsJsonString(dict)
    }
}